<!-- 目录 -->
<template>
    <div class="outer" @scroll="handleScroll">
        <el-table :data="list" stripe>
            <el-table-column fixed prop="pc" label="会员批次">
                <template slot-scope="scope">
                    <div>{{ scope.row.pc.start_time }}</div>
                    <div>{{ scope.row.pc.end_time }}</div>
                </template>
            </el-table-column>
            <el-table-column prop="user_nickname" label="会员账号">
            </el-table-column>
            <!-- <el-table-column prop="state" align='center' label="账号状态">
            </el-table-column> -->
            <el-table-column prop="action" align='center' label="行为数据" width="120">
                <template slot-scope="scope">
                    <div class="acs">
                        <div class="action">
                            <div>
                                发文<span>{{ scope.row.num1 }}</span>
                            </div>
                            <div>
                                摘抄<span>{{ scope.row.num2 }}</span>
                            </div>
                        </div>
                        <div class="action">
                            <div>
                                评论<span>{{ scope.row.num3 }}</span>
                            </div>
                            <div>邀请<span>{{ scope.row.num4 }}</span>
                            </div>
                        </div>
                    </div>
                </template>
            </el-table-column>
            <el-table-column prop="tem" align='center' width="70" label="完成率">
                <template slot-scope="scope">
                    <span style="color:#FF6600;">{{ scope.row.wcl }}</span>
                </template>
            </el-table-column>
            <el-table-column prop="new_time" align='center' label="最新访问">
            </el-table-column>
            <el-table-column prop="views" align='center' width="80" label="访问次数">
            </el-table-column>
            <el-table-column prop="join_time" align='center' label="入会时间">
            </el-table-column>
            <el-table-column prop="way" align='center' label="入会方式">
            </el-table-column>
            <el-table-column prop="end_time" align='right' label="退会时间" width="100">
            </el-table-column>
        </el-table>
        <div class="bottom" v-loading="loading"></div>
    </div>
</template>
<script>
export default {
    data() {
        return {
            title: '',
            loading: true,
            price: '',
            checked: false,
            readOnly: true,
            checked1: false,
            value1: '第一回甄士隐梦幻识通灵贾雨村风尘怀闺秀',
            value2: 2,
            value3: 1,
            sort: 'down',
            pageNum: 1,
            totalPage: 1,
            total: 0,
            new_id: '',
            list: [],
            id: ''
        }
    },
    mounted() {
        window.addEventListener('scroll', this.handleScroll); // 监听滚动事件
        let id = this.$route.query.id
        console.log(id, '获取到的传参')
        if (id) {
            this.new_id = id
            this.pageNum = 1
        }
        this.getList()
    },
    methods: {
        getList() {
            this.loading = true
            let params = {
                page: this.pageNum,
                id: this.id != 0 ? this.id : this.new_id
            }
            this.$api.getMember(params).then(res => {
                if (res.data.code == 1) {
                    this.totalPage = res.data.data.last_page
                    this.list = this.list.concat(res.data.data.data);
                    this.total = res.data.data.total
                    this.loading = false
                    console.log(this.list, '12312312swx')
                }

            })
        },
        handleScroll(event) {
            const { scrollTop, scrollHeight, clientHeight } = event.target;
            if (scrollTop + clientHeight >= scrollHeight) {
                console.log('滚动到底部了！');
                this.$message({
                    message: '到底了',
                    type: 'info'
                })
                this.scrollBottom()
            }
        },
        //滚到底部的分页
        scrollBottom() {

        },
        //添加条目
        additem() {
            console.log('add');

        },
        //确认删除
        confirm(id) {
            console.log('删除');

        },
        //input失焦
        handleBlur() {
            console.log('失焦');
        },
        // 勾选试读
        change(e) {
            console.log(e);

        },
        //排序
        getSort() {
            if (this.sort == 'down') {
                this.sort = 'up'
            } else {
                this.sort = 'down'
            }
        },
        //跳页面
        goPage(id, url) {
            if (id) {
                this.$router.push({
                    path: url,
                    query: {
                        id
                    }
                })
            }
        }
    }
}
</script>
<style lang="scss" scoped>
.outer {
    padding-left: 2.81rem;
    padding-right: 2px;
    height: 100%;
    overflow-y: auto;
    -ms-overflow-style: none;
    width: 100%;
    padding-bottom: 98px;

    &::-webkit-scrollbar {
        /*滚动条整体样式*/
        width: 0 !important;
        /*高宽分别对应横竖滚动条的尺寸*/
        height: 0 !important;
    }
}

.topHead {
    border-bottom: 0.05rem solid #E5E5E5 !important;
    position: sticky;
    top: 0rem;
    background-color: #fff;
    z-index: 22;

    .operate {
        display: flex;
        justify-content: center !important;
    }
}

.l-list {
    width: 100%;
    display: flex;
    height: 3.12rem;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 0;
    border-bottom: 0.05rem dashed #E5E5E5;

    >div {
        display: flex;
        align-items: center;
        font-family: Microsoft YaHei;
        font-weight: 400;
        font-size: 1rem;
        color: #333333;
        height: 100%;

        box-sizing: border-box;
    }

    input {
        outline: none;
        height: 100%;
        font-family: Microsoft YaHei;
        font-weight: 400;
        font-size: 1rem;
        color: #333333;
        width: 100%;
        border: none;
        text-align: center;

    }

    .input {
        width: 33.85rem;

        input {
            text-align: left;
        }
    }

    .price {
        width: 4.63rem;

        input {
            text-align: center;

        }
    }

    .check {
        width: 2.08rem;
        display: flex;
        justify-content: center;
    }

    .sort {
        width: 3.4rem;
        display: flex;
        justify-content: center;
        align-items: center;
        cursor: pointer;

        >div {
            margin-left: 0.2rem;
            display: flex;
            flex-direction: column;

            i {
                &:first-child {
                    margin-bottom: -0.5rem;
                }
            }
        }
    }

    .operate {
        width: 8.33rem;
        justify-content: space-between;

        span {
            cursor: pointer;
        }
    }
}

.add {
    background-color: #fff;
    position: sticky;
    top: 3.12rem;
    z-index: 22;

    .operate {
        justify-content: center !important;
    }
}

.acs {
    display: flex;
}

.action {
    display: inline-flex;
    flex-direction: column;
    white-space: nowrap;

    span {
        color: #1068E7;
        display: inline-block;

    }

    >div {
        margin-bottom: 0.2rem;
    }

    &:nth-child(2) {
        margin-left: 0.2rem;

        div {
            padding-left: 0.2rem;
            border-left: 0.01rem solid #000;
        }
    }
}
</style>